
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>国际化 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="PERMISSION.html" />
    
    
    <link rel="prev" href="MODEL.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="START.html">
            
                <a href="START.html">
            
                    
                    快速开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="MENU.html">
            
                <a href="MENU.html">
            
                    
                    菜单配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="PAGE.html">
            
                <a href="PAGE.html">
            
                    
                    页面开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="ROUTE.html">
            
                <a href="ROUTE.html">
            
                    
                    系统路由
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="AJAX.html">
            
                <a href="AJAX.html">
            
                    
                    Ajax请求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="MOCK.html">
            
                <a href="MOCK.html">
            
                    
                    Mock模拟数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="STYLE.html">
            
                <a href="STYLE.html">
            
                    
                    样式&主题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="LAYOUT.html">
            
                <a href="LAYOUT.html">
            
                    
                    导航布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="MODEL.html">
            
                <a href="MODEL.html">
            
                    
                    Model(Redux)
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.11" data-path="I18N.html">
            
                <a href="I18N.html">
            
                    
                    国际化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="PERMISSION.html">
            
                <a href="PERMISSION.html">
            
                    
                    权限控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="NGINX.html">
            
                <a href="NGINX.html">
            
                    
                    Nginx配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="PROXY.html">
            
                <a href="PROXY.html">
            
                    
                    开发代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="OTHER.html">
            
                <a href="OTHER.html">
            
                    
                    其他
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >国际化</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x56FD;&#x9645;&#x5316;">&#x56FD;&#x9645;&#x5316;</h1>
<p>&#x5728;<code>/src/i18n</code>&#x4E2D;&#x8FDB;&#x884C;&#x56FD;&#x9645;&#x5316;&#x6587;&#x4EF6;&#x7684;&#x7F16;&#x5199;&#xFF0C;&#x6A21;&#x5757;&#x5316;&#x65B9;&#x5F0F;&#x3002;</p>
<h2 id="&#x9879;&#x76EE;&#x4E2D;&#x56FD;&#x9645;&#x5316;&#x76F8;&#x5173;&#x7684;&#x7EC4;&#x4EF6;&#x8BBE;&#x7F6E;&#xFF1A;">&#x9879;&#x76EE;&#x4E2D;&#x56FD;&#x9645;&#x5316;&#x76F8;&#x5173;&#x7684;&#x7EC4;&#x4EF6;&#x8BBE;&#x7F6E;&#xFF1A;</h2>
<ul>
<li>&#x83DC;&#x5355;&#xFF1A;{local, text} local&#x5BF9;&#x5E94;i18n.menu&#x4E2D;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;text&#x4E3A;&#x56FD;&#x9645;&#x5316;&#x5931;&#x8D25;&#xFF0C;&#x9ED8;&#x8BA4;&#x663E;&#x793A;&#xFF1B;</li>
<li>&#x9875;&#x9762;&#x6807;&#x9898;(Tab&#x6807;&#x7B7E;)&#xFF1A;{local, text} local&#x5BF9;&#x5E94;i18n.menu&#x4E2D;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;text&#x4E3A;&#x56FD;&#x9645;&#x5316;&#x5931;&#x8D25;&#xFF0C;&#x9ED8;&#x8BA4;&#x663E;&#x793A;&#xFF1B;</li>
<li>&#x7B2C;&#x4E09;&#x65B9; Ant Design&#x3001;moment&#x7B49;&#x5728; <code>src/i18n/Local.jsx</code>&#x4E2D;&#x914D;&#x7F6E;&#xFF1B;</li>
<li>&#x7ECF;&#x8FC7;models(redux)&#x5904;&#x7406;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;<code>src/i18n/redux-middleware.js</code>&#x4E2D;&#x5904;&#x7406;&#xFF1B;</li>
</ul>
<h2 id="&#x83B7;&#x53D6;&#x5F53;&#x524D;&#x56FD;&#x9645;&#x5316;&#x5B57;&#x7B26;&#x96C6;&#x5BF9;&#x8C61;">&#x83B7;&#x53D6;&#x5F53;&#x524D;&#x56FD;&#x9645;&#x5316;&#x5B57;&#x7B26;&#x96C6;&#x5BF9;&#x8C61;</h2>
<ul>
<li><p>&#x4E0E;models&#x94FE;&#x63A5;&#x7684;&#x9875;&#x9762;&#xFF1A;</p>
<pre><code class="lang-js">  @config({
      connect: state =&gt; ({
          local: state.system.i18n,
      }),
  })
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SomePage</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">React</span>.<span class="hljs-title">Component</span> </span>{
      render() {
          <span class="hljs-keyword">const</span> userText = <span class="hljs-keyword">this</span>.props.local.menu.users;

          <span class="hljs-keyword">return</span> (
              &lt;div&gt;{userText}&lt;div&gt;
          );
      }
  }
</code></pre>
</li>
<li><p>&#x975E;React&#x7EC4;&#x4EF6;&#xFF0C;&#x65E0;&#x6CD5;&#x4E0E;models&#x94FE;&#x63A5;&#x7684;js&#x65B9;&#x6CD5;&#x4E2D;&#xFF1A;</p>
<pre><code class="lang-js">  <span class="hljs-keyword">import</span> {getCurrentLocal} <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;@/i18n&apos;</span>;

  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">someFunction</span>(<span class="hljs-params"></span>) </span>{
      <span class="hljs-keyword">const</span> currentLocal = getCurrentLocal();
      <span class="hljs-keyword">const</span> userMenuText = currentLocal.menu.users;
      ...
  }
</code></pre>
</li>
</ul>
<h2 id="&#x4E0D;&#x9700;&#x8981;&#x56FD;&#x9645;&#x5316;">&#x4E0D;&#x9700;&#x8981;&#x56FD;&#x9645;&#x5316;</h2>
<p>&#x5982;&#x679C;&#x4E0D;&#x9700;&#x8981;&#x56FD;&#x9645;&#x5316;&#xFF0C;&#x53BB;&#x6389;local&#x76F8;&#x5173;&#x914D;&#x7F6E;&#x5373;&#x53EF;&#xFF0C;&#x7CFB;&#x7EDF;&#x9ED8;&#x8BA4;&#x7B80;&#x4F53;&#x4E2D;&#x6587;&#x3002;</p>
<ul>
<li>&#x83DC;&#x5355;&#xFF1A;&#x53BB;&#x6389;local</li>
<li>&#x9875;&#x9762;&#x6807;&#x9898;(Tab&#x6807;&#x7B7E;)&#xFF1A;&#x76F4;&#x63A5;&#x4F20;&#x9012;&#x9700;&#x8981;&#x663E;&#x793A;&#x7684;&#x5185;&#x5BB9;(&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;ReactNode)&#xFF0C;&#x4E0D;&#x9700;&#x8981;{local, text}&#x8FD9;&#x6837;&#x7684;&#x7ED3;&#x6784;</li>
</ul>
<p>&#x6CE8;&#xFF1A;&#x8003;&#x8651;&#x5230;&#x5B9E;&#x9645;&#x5F88;&#x591A;&#x7CFB;&#x7EDF;&#x4E0D;&#x9700;&#x8981;&#x56FD;&#x9645;&#x5316;&#x3001;&#x7B80;&#x5316;&#x4EE3;&#x7801;&#x590D;&#x6742;&#x5EA6;&#xFF0C;&#x4E00;&#x4E9B;&#x5185;&#x7F6E;&#x7684;demo&#x9875;&#x9762;&#x5E76;&#x6CA1;&#x6709;&#x6DFB;&#x52A0;&#x56FD;&#x9645;&#x5316;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="MODEL.html" class="navigation navigation-prev " aria-label="Previous page: Model(Redux)">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="PERMISSION.html" class="navigation navigation-next " aria-label="Next page: 权限控制">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"国际化","level":"1.11","depth":1,"next":{"title":"权限控制","level":"1.12","depth":1,"path":"PERMISSION.md","ref":"PERMISSION.md","articles":[]},"previous":{"title":"Model(Redux)","level":"1.10","depth":1,"path":"MODEL.md","ref":"MODEL.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"I18N.md","mtime":"2019-02-16T09:08:05.321Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-02-17T03:27:10.809Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

